﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace SPHelpCollectionBuilder
{
    public partial class LocalePicker : Form
    {
        public string SelectedLocaleFolder
        {
            get
            {
                return listBoxLocale.SelectedItem.ToString();
            }
        }

        public LocalePicker()
        {
            InitializeComponent();
            LoadData();
        }

        private void LoadData()
        {
            if (Directory.Exists(ConfigManager.HiveLocation))
            {
                string HCCabFolder = string.Concat(ConfigManager.HiveLocation, @"\\HCCab");
                DirectoryInfo HCCabDi = new DirectoryInfo(HCCabFolder);

                DirectoryInfo[] subDirs = HCCabDi.GetDirectories();

                if (subDirs != null)
                {
                    for (int i = 0; i < subDirs.Length; i++)
                    {
                        listBoxLocale.Items.Add(subDirs[i].FullName);
                    }
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
        }

    }
}
